//便捷处理监听事件与回调
//需要注入监听key

export default function (emitKey) {
    return {
        created() {
            // console.log
            this.$bus.$on(emitKey, (funName, ...argn) => {
                if (this[funName]) this[funName](...argn)
            })
        },
        destroyed() {
            // console.log
            this.$bus.$off(emitKey)
        },
    }
}
